home *** CD-ROM | disk | FTP | other *** search
/ 1,000+ Great Games / 1_1000 Games.iso / FLITESIM / FULOG.ZIP / FULOG.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-03  |  24.6 KB  |  713 lines

  1. /*-
  2.  *  $Date: 7/29/95 6:27p $
  3.  *  $Workfile: fulog.cpp $
  4.  *  $Archive: /FULog/fulog.cpp $
  5.  *---------------------------------------------------------------------
  6.  *
  7.  *  Module Name    : fulog.cpp
  8.  *
  9.  *  Description    : Flight Unlimited Log File listing program.
  10.  *                   In addition to a normal log listing this program
  11.  *                   allows including/excluding specific entries and
  12.  *                   gives statistics about the flight time in different
  13.  *                   planes and from different airports. Also gives some
  14.  *                   extended lesson statistics.
  15.  *                   
  16.  *
  17.  *  Classification : Public Domain
  18.  *
  19.  *  Status         : New
  20.  *
  21.  *  Initial Author : Jesper Hansen
  22.  *
  23.  *  Restrictions   : None
  24.  *
  25.  *  Compiler       : Watcom C++ 10.0 / Microsoft Visual C++ 1.51
  26.  *
  27.  *  Notes          : This file contain all the code for the Log program.
  28.  *                   Most class code is implemented directly in the class,
  29.  *                   to make the classes more readable.
  30.  *                   Comments are sparse,  this is a quick hack.
  31.  *                   Contains long lines, way beyond 80 positions !
  32.  *
  33.  *
  34.  *
  35.  *  Change Activity:
  36.  *  $Log: /FULog/fulog.cpp $
  37.  * 
  38.  * 1     7/29/95 6:27p Jeha
  39.  * wrote it !
  40.  * 
  41.  * 
  42.  *---------------------------------------------------------------------
  43. -*/
  44.  
  45. #include <iostream.h>
  46. #include <fstream.h>
  47. #include <strstrea.h>
  48. #include <iomanip.h>
  49. #include <assert.h>
  50. #include <time.h>
  51. #include <stdio.h>
  52. #include <stdlib.h>
  53. #include <time.h>         
  54. #include <string.h>
  55. #include <dos.h>
  56.  
  57. #define PILOT_FILE          "pilot000.log"  // default log file
  58. #define PLANE_FILE          "planes.ful"    // file containing plane names
  59. #define AIRPORT_FILE        "airports.ful"  // file containing airport names
  60. #define LESSON_FILE         "lessons.ful"   // file containing lesson names
  61.  
  62. #define MAX_NAME_ENTRIES    100             // max entries allowed in plane,
  63.                                             // airport and lesson files
  64.  
  65. #define MAX_LOG_ENTRIES      5000            // max entries allowed in the log
  66.  
  67. #define NUM_DISPLAY_FIELDS  6               // number of fields in list display
  68. #define FIELDIDS            "dpiatc"        // field name id's
  69.  
  70. #define DEAD_BEEF_END       0x0A34          // figure this one out yourself
  71.  
  72.  
  73.  
  74. #pragma pack(1)                             // need to pack the structs
  75.  
  76. //
  77. // The log entry structure
  78. //
  79. //  ( For a more detailed explanation of the log
  80. //    file format, please see the readme file )
  81. //
  82. typedef struct
  83. {
  84.     char    entrytype;          // type of entry
  85.     long    nextsimilar;        // index of next entry of the same type
  86.     long    prevsimilar;        // index of previous entry of the same type
  87.     long    next;               // index of next entry
  88.     long    prev;               // index of previous entry
  89.     long    date;               // flight date in UTC format
  90.     long    flighttime;         // duration of this flight
  91.     int     plane;              // the plane used
  92.     char    planeid[6];         // the plane designation
  93.     char    comment[128];       // comment
  94.     long    reserved;           // dont know
  95.     int     airport;            // the airport used
  96.     int     maneuvernumber;     // maneuver/group number for certification/award
  97.     int     certoraward;        // flag for cetification (0) or award (1)
  98.     int     certnumber;         // some internal certification/award value
  99.     char    filler[83];         // ?
  100. } LogRecord;
  101.  
  102.  
  103.  
  104. //////////////////////////////////////////////////////////////////////
  105. //  Class       :   NameArray
  106. //
  107. //  Description :   Handles a variable list of names.
  108. //                  The list is loaded from a standard ASCII file
  109. //                  containing a name on each line.
  110. //
  111. //////////////////////////////////////////////////////////////////////
  112. class NameArray
  113. {
  114.     int m_z;            // entry count
  115.     char **m_name;      // entry pointer
  116. public:
  117.     NameArray() { m_z=0; m_name = new char*[MAX_NAME_ENTRIES]; }
  118.     ~NameArray() { while (m_z) delete [] m_name[--m_z]; delete [] m_name; }
  119.     void Load(char *fn) { ifstream ins(fn);
  120.                      if (!ins)
  121.                      {
  122.                         cout << "Error: File '" << strupr(fn) << "' not found !" << endl;
  123.                         exit(1);
  124.                      }
  125.                      while (!ins.eof())
  126.                      {
  127.                         m_name[m_z] = new char[40];
  128.                         ins.get(m_name[m_z],40);
  129.                         ins.ignore();
  130.                         if (!ins.eof())
  131.                             m_z++;
  132.                       }
  133.                    }
  134.     int NumEntries() { return m_z; }
  135.     char *GetEntry(int index) { return m_name[index]; }
  136.     void Show(int index) { cout << m_name[index]; }
  137. };
  138.  
  139. //////////////////////////////////////////////////////////////////////
  140. //  Class       :   FLTime
  141. //
  142. //  Description :   Supplies some routines for handling time.
  143. //                  Conversion between packed time and h,m,s value.
  144. //
  145. //////////////////////////////////////////////////////////////////////
  146. class FLTime
  147. {
  148.     long m_h;
  149.     long m_m;
  150.     long m_s;
  151.     long m_t;
  152. public:
  153.     FLTime() { m_h = m_m = m_s = m_t = 0; }
  154.     void TimeToHMS() {   m_s = m_t; m_h = m_s/3600; m_s -= m_h*3600;
  155.                     m_m = m_s/60; m_s -= m_m*60;
  156.                 }
  157.     void HMSToTime() { m_t = m_h*3600+m_m*60*m_s; }
  158.     long GetH() { return m_h; }
  159.     long GetM() { return m_m; }
  160.     long GetS() { return m_s; }
  161.     long GetT() { return m_t; }
  162.     void SetHMS(long ph,long pm,long ps) { m_h = ph; m_m = pm; m_s = ps; }
  163.     void SetT(long pt) { m_t = pt; }
  164.     void ShowHMS()  { cout << setw(2) << setfill('0') << m_h << ':';
  165.                  cout << setw(2) << m_m << ':' << setw(2) << m_s;
  166.                }
  167.     void ShowT(long pt) { m_t = pt; TimeToHMS(); ShowHMS(); }
  168. };
  169.  
  170.  
  171.  
  172. //////////////////////////////////////////////////////////////////////
  173. //  Class       :   LogEntry
  174. //
  175. //  Description :   Handles the loading of and interfaces to the Log
  176. //                  file data.
  177. //                  The list is loaded from a standard ASCII file
  178. //                  containing a name on each line.
  179. //
  180. //////////////////////////////////////////////////////////////////////
  181.  
  182. //
  183. // overloaded operator for loading log entries
  184. //
  185. istream& operator >> (istream& s,LogRecord& r)
  186. {
  187.     s.read((unsigned char *)&r,sizeof(LogRecord));
  188.     return s;
  189. }
  190.  
  191. class LogEntry
  192. {
  193.     LogRecord** m_entry;            // pointer to log record array
  194.     LogRecord*  m_current;          // pointer to the current record
  195.     int         m_z;                // number of records read
  196.     int         m_first;            // pointer to first user record
  197.     int*        m_lessonscores;     // pointer to lesson score record
  198.     char*       m_Name;             // pilot name
  199.     char*       m_Sex;              // pilot sex
  200.     char*       m_Height;           // pilot height (why do they need this ?)
  201.     char*       m_Birthday;         // try taking a lesson this day (or cristmas (or new years day))
  202. public:
  203.     LogEntry() { m_z = m_first = 0;
  204.                  m_entry = new LogRecord* [MAX_LOG_ENTRIES];
  205.                  m_current = 0;
  206.                }
  207.     ~LogEntry() { while (m_z) delete [] m_entry[--m_z]; delete [] m_entry; }
  208.     void SetPersonal(LogRecord *pentry) {
  209.                         m_Sex       = ((char *)&pentry->next);
  210.                         m_Height    = ((char *)&pentry->next)+40;
  211.                         m_Birthday  = ((char *)&pentry->next)+80;
  212.                         }
  213.     void Load(char *fn) {    ifstream ins(fn,ios::in | ios::binary);
  214.                         if (!ins)
  215.                         {
  216.                             cout << "Error: File '" << strupr(fn) << "' not found !" << endl;
  217.                             exit(1);
  218.                         }
  219.                         m_Name = new char[40];
  220.                         ins.read(m_Name,40);
  221.                         ins.seekg(DEAD_BEEF_END);
  222.                         while (!ins.fail())
  223.                         {
  224.                             m_entry[m_z] = new LogRecord;
  225.                             ins >> *m_entry[m_z];
  226.                             if ( (unsigned char)m_entry[m_z]->entrytype < 0x80 && !m_first)
  227.                                 m_first = m_z;
  228.                             if ((unsigned char)m_entry[m_z]->entrytype == 0x80)
  229.                                 m_lessonscores = (int *) &m_entry[m_z]->next;
  230.                             if ((unsigned char)m_entry[m_z]->entrytype == 0x82)
  231.                                 SetPersonal(m_entry[m_z]);
  232.                             m_z++;
  233.                         }
  234.                    }
  235.     int NumEntries() { return m_z; }
  236.     LogRecord* Rewind() { m_current = m_entry[m_first]; return m_current; }
  237.     LogRecord* GetNext() { m_current = ((long) m_current->next != -1) ? m_entry[m_current->next] : NULL;
  238.                            return m_current;
  239.                          }
  240.     LogRecord* GetEntry(int index) { return m_entry[index]; }
  241.     char *GetName() { return m_Name; }
  242.     char *GetSex()  { return m_Sex; }
  243.     char *GetHeight() { return m_Height; }
  244.     char *GetBirthday() { return m_Birthday; }
  245.     int GetLessonScore(int plesson) { return m_lessonscores[plesson]; }
  246. };
  247.  
  248.  
  249. //////////////////////////////////////////////////////////////////////
  250. //  Class       :   FULog
  251. //
  252. //  Description :   Main work horse.
  253. //                  Goes through the log entries, handles the inclusion/
  254. //                  exclusion of specific entries.
  255. //                  Maintains timings for planes and airports.
  256. //                  Also contains most of the display routines.
  257. //
  258. //////////////////////////////////////////////////////////////////////
  259. class FULog
  260. {   NameArray p,a,l;
  261.     LogEntry le;
  262.     FLTime f;
  263.  
  264.     int     m_pausecount;               // pause screen count
  265.     int     m_pause;                    // pause screen flag
  266.     char*   m_fieldids;                 // pointer to fiels Id's
  267.     int     m_skip[NUM_DISPLAY_FIELDS]; // skip field array
  268.     char*   m_include;                  // pointer to include strings
  269.     char*   m_exclude;                  // pointer to exclude strings
  270.     char*   m_type;                     // pointer to include types
  271.     long    m_listtime;                 // sum of flight time listed
  272.     long    m_totaltime;                // total summed flight time
  273.     long*   m_planetime;                // summed flight time on individual planes
  274.     long*   m_airporttime;              // summed flight time for airports
  275.  
  276. public:
  277.     FULog() {   m_fieldids = FIELDIDS;
  278.                 memset(&m_skip,0,sizeof(m_skip));
  279.                 m_include = m_exclude = 0;
  280.                 m_type = "0123456789";
  281.                 m_listtime = m_totaltime = 0;
  282.                 m_pause = 0;
  283.                 m_pausecount = 0;
  284.             }
  285.     void Load(char* fn) { p.Load(PLANE_FILE);
  286.                      a.Load(AIRPORT_FILE);
  287.                      l.Load(LESSON_FILE);
  288.                      le.Load(fn ? fn : PILOT_FILE );
  289.                      m_planetime = new long[p.NumEntries()];
  290.                      for (int i=0;i<p.NumEntries();i++)
  291.                         m_planetime[i] = 0;
  292.                      m_airporttime = new long[a.NumEntries()];
  293.                      for (i=0;i<a.NumEntries();i++)
  294.                         m_airporttime[i] = 0;
  295.                    }
  296.     void SetSkip(char c) { m_skip[strchr(m_fieldids,c) - m_fieldids] = 1; }
  297.     int SkipState(int i) { return m_skip[i]; }
  298.     void SetInclude(char *pc) { m_include = pc; }
  299.     void SetExclude(char *pc) { m_exclude = pc; }
  300.     int IsIncluded(char *pc);
  301.     int IsExcluded(char *pc);
  302.     void SetType(char *pc) { m_type = pc; }
  303.     void ShowPilot() {   cout << "Name     : " << le.GetName() << endl;
  304.                     cout << "Sex      : " << le.GetSex() << endl;
  305.                     cout << "Height   : " << le.GetHeight() << endl;
  306.                     cout << "Birthday : " << le.GetBirthday() << endl;
  307.                     cout << endl;
  308.                 }
  309.     void List();
  310.     void SetPauseMode(int pmode) { m_pause = pmode; }
  311.     void SetPauseCount(int pc) { m_pausecount = pc; }
  312.     void CheckPause() {  if (m_pause)
  313.                     {
  314.                         if (!m_pausecount--)
  315.                         {
  316.                             cout << " -- More --";
  317.                             cin.ignore();
  318.                             cout << "\r";
  319.                             m_pausecount = 23;
  320.                         }
  321.                     }
  322.                  }
  323.     void ShowTime()  {   cout << "Listed Flight Time ";
  324.                     f.ShowT(m_listtime);
  325.                     cout << endl;
  326.                     CheckPause();
  327.                     cout << "Total Flight Time  ";
  328.                     f.ShowT(m_totaltime);
  329.                     cout << endl;
  330.                     CheckPause();
  331.                 }
  332.  
  333.     void ShowStats() {   cout << endl;
  334.                     CheckPause();
  335.                     cout << "Plane Flight Times" << endl;
  336.                     CheckPause();
  337.                     for (int i=0;i<p.NumEntries();i++)
  338.                     {
  339.                         cout << setw(17) << setfill(' ') << p.GetEntry(i) << "  ";
  340.                         f.ShowT(m_planetime[i]);
  341.                         cout << "  " << m_planetime[i]*100/m_totaltime << '%';
  342.                         cout << endl;
  343.                         CheckPause();
  344.                     }
  345.                     cout << endl;
  346.                     CheckPause();
  347.                     cout << "Airport Flight Times" << endl;
  348.                     CheckPause();
  349.                     for (i=0;i<a.NumEntries();i++)
  350.                     {
  351.                         cout << setw(17) << setfill(' ') << a.GetEntry(i) << "  ";
  352.                         f.ShowT(m_airporttime[i]);
  353.                         cout << "  " << m_airporttime[i]*100/m_totaltime << '%';
  354.                         cout << endl;
  355.                         CheckPause();
  356.                     }
  357.                     cout << endl;
  358.                     CheckPause();
  359.                     cout << "Lesson Statistics" << endl;
  360.                     CheckPause();
  361.                     cout << setw(30) << setfill(' ') << "Lesson" << "  " << "Score  Status\n";
  362.                     CheckPause();
  363.                     int lesson_total = 0;
  364.                     int lesson_count = 0;
  365.                     int score;
  366.                     for (i=0;i<l.NumEntries();i++)
  367.                     {
  368.                         score = le.GetLessonScore(i);
  369.                         cout << setw(30) << l.GetEntry(i) << "   ";
  370.                         cout << setw(2) << score/10 << '.' << score - (score/10*10) << "   ";
  371.                         cout << ((score >= 80) ? "Completed" : ((score != 0) ? "Trained" : "Not Tried"));
  372.                         cout << endl;
  373.                         CheckPause();
  374.                         if (score >= 80)
  375.                         {
  376.                             lesson_total += score;
  377.                             lesson_count++;
  378.                         }
  379.                     }
  380.                     cout << "\nAverage Score on Completed Lessons = ";
  381.                     if (lesson_count)
  382.                     {
  383.                         score = lesson_total / lesson_count;
  384.                         cout << score/10 << '.' << score - (score/10*10);
  385.                     }
  386.                     else
  387.                         cout << "No Lessons Completed";
  388.                     cout << endl;
  389.  
  390.                 }
  391. };
  392.  
  393. //
  394. // check whether the supplied string contains include strings
  395. //
  396. int FULog::IsIncluded(char* pc)
  397. {   char *q;
  398.  
  399.     if (!m_include)
  400.         return 1;
  401.  
  402.     char *a = strdup(m_include);
  403.     q = strtok(a,",\0");
  404.     while (q)
  405.     {
  406.         if (strstr(pc,q))
  407.         {
  408.             free(a);
  409.             return 1;
  410.         }
  411.         q = strtok(NULL,",\0");
  412.     }
  413.     free(a);
  414.     return 0;
  415. }
  416.  
  417. //
  418. // check whether the supplied string contains exclude strings
  419. //
  420. int FULog::IsExcluded(char* pc)
  421. {   char *q;
  422.  
  423.     if (!m_exclude)
  424.         return 0;
  425.  
  426.     char *a = strdup(m_exclude);
  427.     q = strtok(a,",\0");
  428.     while (q)
  429.     {
  430.         if (strstr(pc,q))
  431.         {
  432.             free(a);
  433.             return 1;
  434.         }
  435.         q = strtok(NULL,",\0");
  436.     }
  437.     free(a);
  438.     return 0;
  439. }
  440.  
  441.  
  442. //
  443. // Main list routine
  444. //  generates a complete line for include/exclude checks
  445. //  then display all non-skipped fields
  446. //
  447. void FULog::List()
  448. {   LogRecord* lr;
  449.     char temp[80],temp2[80],field[80],*q;
  450.     struct tm* stime;
  451.     int padding;
  452.  
  453.  
  454.     lr = le.Rewind();
  455.     while (lr)
  456.     {
  457.         if ((unsigned char)lr->entrytype < 0x80)
  458.         {
  459.             *temp = *temp2 = *field = padding = 0;
  460.             ostrstream testline(temp,80,ios::app);
  461.             ostrstream outline(temp2,80,ios::app);
  462.  
  463.             m_totaltime += lr->flighttime;
  464.  
  465.             m_planetime[lr->plane] += lr->flighttime;
  466.             m_airporttime[lr->airport] += lr->flighttime;
  467.  
  468.             stime  = localtime((/*unsigned*/ long *)&lr->date);
  469.             sprintf(field,"%2d/%-2d ",stime->tm_mday,stime->tm_mon+1); // format fields
  470.             testline << field;
  471.             if (!SkipState(0))
  472.             {
  473.                 outline << field;
  474.                 padding += strlen(field);
  475.             }
  476.             sprintf(field,"%-9s ",p.GetEntry(lr->plane));
  477.             testline << field;
  478.             if (!SkipState(1))
  479.             {
  480.                 outline << field;
  481.                 padding += strlen(field);
  482.             }
  483.             sprintf(field,"%5s ",lr->planeid);
  484.             testline << field;
  485.             if (!SkipState(2))
  486.             {
  487.                 outline << field;
  488.                 padding += strlen(field);
  489.             }
  490.             sprintf(field,"%-12s ",a.GetEntry(lr->airport));
  491.             testline << field;
  492.             if (!SkipState(3))
  493.             {
  494.                 outline << field;
  495.                 padding += strlen(field);
  496.             }
  497.  
  498.             outline << '\0';    // why do we need this ?
  499.             testline << '\0';
  500.  
  501.             if (strchr(m_type,lr->entrytype+'0') &&
  502.                 IsIncluded(testline.str()) &&
  503.                 !IsExcluded(testline.str()) )
  504.             {
  505.                 m_listtime += lr->flighttime;
  506.  
  507.                 cout << outline.str();
  508.  
  509.                 if (!SkipState(4))
  510.                 {
  511.                     f.SetT(lr->flighttime);
  512.                     f.TimeToHMS();
  513.                     sprintf(field,"%02lu:%02lu:%02lu ",f.GetH(),f.GetM(),f.GetS());
  514.                     cout << field;
  515.                     padding += strlen(field);
  516.                 }
  517.                 
  518.                 if (!SkipState(5))
  519.                 {
  520.                     unsigned int len = 32;
  521.                     q = lr->comment;
  522.                     while (strlen(q) > len)
  523.                     {
  524.                         q += len;
  525.                         while (*q != ' ')
  526.                             q--;
  527.                         *q++ = '\n';
  528.                     }
  529.  
  530.                     q = strtok(lr->comment,"\n\0");           // first part of string
  531.                     while (q)                                       // while more
  532.                     {
  533.                         cout << q;                                  // print it
  534.  
  535.                         q = strtok(NULL,"\n\0");                    // get next part
  536.                         if (q)                                      // if more to come
  537.                         {
  538.                             cout << endl;
  539.                             CheckPause();
  540.                             cout << setfill(' ') << setw(padding) << "";                   // pad with spaces
  541.                         }
  542.                     }
  543.                 }
  544.                 cout << endl;
  545.                 CheckPause();
  546.             }
  547.  
  548.         }
  549.         lr = le.GetNext();
  550.     }
  551.  
  552.     cout << endl;
  553.     CheckPause();
  554. }
  555.  
  556.  
  557. //////////////////////////////////////////////////////////////////////
  558. //  Function    :   help
  559. //
  560. //  Description :   Display usage notes for the program
  561. //
  562. //////////////////////////////////////////////////////////////////////
  563. void help()
  564. {
  565.     cout << "usage :\n";
  566.     cout << "   fulog [-options] [filename] [-options] \n\n";
  567.     cout << "options can be placed either before or after the filename, and can\n";
  568.     cout << "be prefixed with either '-' or '/'.\n";
  569.     cout << "filename are the name of a Flight Unlimited pilot log file.\n";
  570.     cout << "If no filename are specified, 'PILOT000.LOG' will be used as default.\n";
  571.     cout << "Options :\n";
  572.     cout << "   -i<string>[,string] ...     - include only fields containing the\n";
  573.     cout << "                                 given strings.\n";
  574.     cout << "   -e<string>[,string] ...     - exclude fields containing the given strings.\n";
  575.     cout << "   -s[dpiatc]                  - skip the fields indicated.\n";
  576.     cout << "                                 (d=date,p=plane e.t.c.)\n";
  577.     cout << "   -t<n>                       - include only entries of the given type.\n";
  578.     cout << "                                 Types are : \n";
  579.     cout << "                                             1 - Lessons\n";
  580.     cout << "                                             2 - Solo Flight\n";
  581.     cout << "                                             3 - Hoops Courses\n";
  582.     cout << "                                             4 - Certification\n";
  583.     cout << "   -d                          - display extended statistics.\n";
  584.     cout << "   -p                          - pause on each screen.\n";
  585.     cout << "   -f                          - skip delay at program start.\n";
  586.     cout << "   -? or -h                    - display this help.";
  587.     cout << endl;
  588.     exit(0);        // terminate
  589. }
  590.  
  591. //////////////////////////////////////////////////////////////////////
  592. //  Function    :   main
  593. //
  594. //  Description :   Well, main entry point actually
  595. //
  596. //////////////////////////////////////////////////////////////////////
  597.  
  598. void main(int argc, char **argv)
  599. {   char *fields[NUM_DISPLAY_FIELDS] = {"Date ","Plane    ","Ident","Airport     ","Time    ","Comment                         "};
  600.     int i,fastmode = 0,helpmode = 0, stats = 0, pause = 0;
  601.     char c, *filename = NULL;
  602.     FULog Log;
  603.  
  604.     //
  605.     // parse argument list
  606.     //
  607.     for (i=1;i<argc;i++)
  608.     {
  609.         if (strcspn(argv[i],"-/"))
  610.             filename = argv[i];    
  611.         else
  612.         {
  613.             switch ( c = *(++argv[i]) )
  614.             {
  615.                 case 's' :  // skip
  616.                     while ((c = *(++argv[i])) != 0)
  617.                         Log.SetSkip( c );
  618.                     break;
  619.                  case 'e' :  // exclude
  620.                     Log.SetExclude( argv[i]+1 );
  621.                     break;    
  622.                  case 'i' :  // include
  623.                     Log.SetInclude( argv[i]+1 );
  624.                     break;    
  625.                 case 't' :  // type
  626.                     Log.SetType( argv[i]+1 );
  627.                     break;
  628.                 case 'd' :
  629.                     stats = 1;
  630.                     if (*(argv[i]+1) == '-')
  631.                         Log.SetInclude("dummy");
  632.                     break;
  633.                 case 'p' :
  634.                     pause = 1;
  635.                     break;
  636.                 case 'f' :
  637.                     fastmode = 1;
  638.                     break;
  639.                 case '?' :
  640.                 case 'h' :
  641.                     helpmode = 1;
  642.                     break;
  643.             }
  644.         }            
  645.     }    
  646.  
  647.     //
  648.     // display program header
  649.     //
  650.  
  651.     cout << "\n\nFlight Unlimited  Pilot Log,  Luxury Edition :)\n";
  652.     cout <<   "-----------------------------------------------\n";
  653.     cout <<   "Jesper Hansen CIS:100335,3165 jeha@hk.enator.se\n";
  654.     cout <<   "Version F1;4S     July 1995       Public Domain\n";
  655.     cout <<   "-----------------------------------------------\n\n";
  656.  
  657.     //
  658.     // make sure the user sees it
  659.     //
  660.  
  661. //    if (!fastmode) sleep(2); 
  662.  
  663.     //
  664.     // display help for the novice
  665.     //
  666.     if (helpmode) help();        
  667.  
  668.     //
  669.     // load files
  670.     //
  671.     Log.Load(filename);
  672.  
  673.     //
  674.     // show pilot information
  675.     //
  676.     Log.ShowPilot();
  677.  
  678.     //
  679.     // show fields names and underline each
  680.     //
  681.     for (i=0;i<NUM_DISPLAY_FIELDS;i++)
  682.         if (!Log.SkipState(i))
  683.             cout << fields[i] << " ";
  684.     cout << endl;
  685.     for (i=0;i<NUM_DISPLAY_FIELDS;i++)
  686.         if (!Log.SkipState(i))
  687.             cout << setw(strlen(fields[i])) << setfill('-') << "" << " ";
  688.     cout << endl;
  689.  
  690.     //
  691.     // set up pause mode
  692.     //
  693.     Log.SetPauseMode(pause);
  694.     Log.SetPauseCount(8);
  695.  
  696.     //
  697.     // list it
  698.     //
  699.     Log.List();
  700.  
  701.     //
  702.     // display time statistics
  703.     //
  704.     Log.ShowTime();
  705.  
  706.     //
  707.     // display extended statistics
  708.     //
  709.     if (stats) Log.ShowStats();
  710.  
  711.     // bye
  712. }
  713.